<?php

namespace App\Listeners;

use App\Events\Delivery;
use App\Models\RoomSendHis;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;


class SendSmsNotification implements ShouldQueue
{

    use InteractsWithQueue;

    public $tries = 3; // 允许任务尝试的最大次数

    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  Delivery  $event
     * @return void
     */
    public function handle(Delivery $event)
    {
        if ($event->roomSendHis->send_status == RoomSendHis::SEND_STATUS_ING) {
            // 下单通知
        }
    }

    public function failed(Exception $exception)
    {
        // TODO 有异常未解决，Exception

    }
}
